<template>
  <div>
    <van-button type="danger">危险按钮</van-button>
    <div class="divbox"></div>
    <div style="width: 375px; height: 375px"></div>
  </div>
</template>

<script setup lang="ts">
import { onMounted } from 'vue';
import { useUserStore } from '@/stores/modules/user';
import { api_query_arcticlList, api_login } from '@/apis/user';
import type { User } from '@/types/user.d';

const userStore = useUserStore();

// userStore.setUserInfo({id:'1', token:'aaaaaa'})

// mobile:'13211112222',
// password: 'abc12345'
const loginFn = async () => {
  try {
    let res = await api_login({
      mobile: '13211112222',
      password: 'abc12345_zzz'
    });
    userStore.setUserInfo(res as unknown as User);
    api_query_arcticlList();
  } catch (error) {
    console.log(error);
  }
};

onMounted(() => {
  loginFn();
});
</script>

<style lang="scss" scoped>
.divbox {
  width: 100px;
  height: 375px;
}
</style>
